/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package be.vdab.dao;

import be.vdab.util.HibernateUtil;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

/**
 *
 * @author sven.vanaerschot
 */
public abstract class AbstractDAO {
    protected Session getSession(){
        SessionFactory factory = HibernateUtil.getSessionFactory();
        return factory.getCurrentSession();
    }
    
    public void beginTransaction(){
        Session session= getSession();
        session.beginTransaction();
    }
    
    public void commit(){
        Session session = getSession();
        session.getTransaction();
    }
    
    public void rollback(){
        Session session = getSession();
        session.getTransaction().rollback();
    }
}